<?php
/*
$contextMenu[0]["link"]      = "?do=Proveedor&accion=shwForm";
$contextMenu[0]["linkIcon"]  = "application_add.png";
$contextMenu[0]["linkTitle"] = "Nuevo Proveedor";
*/

$contextMenu[0]["link"]      = "javascript:fn_nuevo()";
$contextMenu[0]["linkIcon"]  = "application_add.png";
$contextMenu[0]["linkTitle"] = "Nuevo Proveedor";

$contextMenu[1]["link"]      = "javascript:fn_listar()";
$contextMenu[1]["linkIcon"]  = "application_view_list.png";
$contextMenu[1]["linkTitle"] = "Lista";
if ($o_Proveedor->getProveedorId()){
    $contextMenu[2]["link"]      = "?do=Proveedor&accion=eliminarProveedor&ProveedorId=".$o_Proveedor->getProveedorId();
    $contextMenu[2]["linkIcon"]  = "page_white_delete.png";
    $contextMenu[2]["linkTitle"] = "Eliminar Proveedor";
}    
?>


<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script>
    function openWindow(url){
        window.open(url,'Wpopup','toolbar=no,location=no left=10 hight=10,scrollbars=yes,width=600,height=125,location=no'); 
    }
    
    function fn_nuevo(){
      $("#zonaContenedor").load("/gourmet-express/trunk/src/index.php?do=Proveedor&accion=shwForm", function(){

      });
    }; 
    function fn_listar(){
      $("#zonaContenedor").load("/gourmet-express/trunk/src/index.php?do=Proveedor&accion=listarProveedorForm", function(){

      });
    }; 	    
  </script>
</head>
  <body>
    <div id="main">
        <div id="zonaContenedor">    
            <div id="module">
                <?php include $_SERVER['DOCUMENT_ROOT'].'/gourmet-express/trunk/src/views/header.inc'; ?>
                <h3>.:: Proveedor</h3>
                <div>
                    <form id="form_Proveedor" action="javascript:<?php echo ( $o_Proveedor->getProveedorId() )? "fn_actualizar();":"fn_guardar();";?>" method="post">
                        <table id="form" width="100%">
                            <tbody>
                                <tr>
                                    <td id="keyLabel">Codigo</td>
                                    <td style="width: 367px;"><?php 
                                                              if($o_Proveedor && $o_Proveedor->getProveedorId())
                                                              {?>
                                                                <input name="prv_proveedorId" readonly="true" value="<?php echo ($o_Proveedor->getProveedorId())?$o_Proveedor->getProveedorId():"";?>" type="hidden"><?php
                                                                echo $o_Proveedor->getProveedorId();
                                                              }else{?>
                                                                <font color="red">Nuevo</font><?php
                                                              }?>
                                    </td>
                                    <td style="width: 150px;" id="label">Estado</td>
                                    <td>                                        
                                        <select name="indEstado"id="indEstado">
                                           <option value=""></option><?php
                                              foreach ($ao_estado_proveedor as $key => $obj){?>
                                              <option value="<?php echo $obj->getValorId();?>" <?php if( $obj->getValorId()==$o_Proveedor->getEstado()){?> selected<?php }?>><?php echo $obj->getDescripcion();?></option><?php
                                              }?>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td id="label">Nombre</td>
                                    <td><input name="nombre" value="<?php echo ($o_Proveedor->getNombre())?$o_Proveedor->getNombre():"";?>" size="50" maxlenght="50" type="text" ></td>
                                    <td id="label">Terminos de Pago</td>
                                    <td>                                       
                                        <select name="terminosPago" id='terminosPago'>
                                           <option value=""></option><?php
                                              foreach ($ao_formaPago as $key => $obj){?>
                                                    <option value="<?php echo $obj->getValorId();?>" <?php if( $obj->getValorId()==$o_Proveedor->getTerminosPago()){?> selected<?php }?>><?php echo $obj->getDescripcion();?></option><?php
                                              }?>
                                        </select>                                        
                                        
                                    </td>
                                </tr
                                <tr>
                                    <td id="label">Tipo</td>
                                    <td>
                                        <select name="tipo" id='tipo'>
                                           <option value=""></option><?php
                                              foreach ($ao_tipoProvee as $key => $obj){?>
                                              <option value="<?php echo $obj->getValorId();?>" <?php if( $obj->getValorId()==$o_Proveedor->getTipo()){?> selected<?php }?>><?php echo $obj->getDescripcion();?></option><?php
                                              }?>
                                        </select>
                                    </td>
                                    <td id="label">Límite de Crédito</td>
                                    <td><input name="creditLimit" value="<?php echo ($o_Proveedor->getCreditLimit())?$o_Proveedor->getCreditLimit():"";?>" size="18" maxlenght="15" type="text"></td>
                                </tr>                                
                                <tr>
                                    <td id="label">Doc.Identidad</td><td style="width: 367px;"><input name="docIdent" value="<?php echo ($o_Proveedor->getDocIdent())?$o_Proveedor->getDocIdent():"";?>" size="20" maxlenght="20" type="text"></td>
                                    <td id="label">Hold</td>
                                    <td>

                                        <select name="hold" id="hold">
                                           <option value="N" <?php if( $o_Proveedor->getHold()=="N"){ echo " SELECTED ";}?>>No</option>
                                           <option value="Y" <?php if( $o_Proveedor->getHold()=="Y"){ echo " SELECTED ";}?>>Si</option>
                                        </select>                                        
                                        
                                        <!--<input type="checkbox" name="hold" value="X" <? if ($o_Proveedor->getHold()){echo " CHECKED ";}?>>-->
                                    </td>
                                </tr>
                                <tr>
                                    <td id="label">Direccion </td>
                                    <td><input name="direcc1" value="<?php echo ($o_Proveedor->getDirecc1())?$o_Proveedor->getDirecc1():"";?>" size="50" maxlenght="20" type="text"><br></td>
                                    <td id="label"><br></td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td id="label"></td>
                                    <td><input name="direcc2" value="<?php echo ($o_Proveedor->getDirecc2())?$o_Proveedor->getDirecc2():"";?>" size="50" maxlenght="20" type="text"><br></td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td id="label">Cuidad</td>
                                    <td><input name="ciudad" value="<?php echo ($o_Proveedor->getCuidad())?$o_Proveedor->getCuidad():"";?>" size="30" maxlenght="20" type="text"><br></td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td id="label">Estado(Dir)</td>
                                    <td><input name="direccEstado" value="<?php echo ($o_Proveedor->getDireccestado())?$o_Proveedor->getDireccestado():"";?>" size="30" maxlenght="10" type="text"> </td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td id="label">Pais</td>
                                    <td><input name="pais" value="<?php echo ($o_Proveedor->getPais())?$o_Proveedor->getPais():"";?>" size="30" maxlenght="20" type="text"><br></td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>    
                                <tr>
                                    <td id="label">Telefono(s)</td>
                                    <td><input name="telefono" value="<?php echo ($o_Proveedor->getTelefono())?$o_Proveedor->getTelefono():"";?>" size="30" maxlenght="20" type="text"><br></td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>                                 
                                <tr>
                                    <td id="label">Email</td>
                                    <td><input name="email"value="<?php echo ($o_Proveedor->getEmail())?$o_Proveedor->getEmail():"";?>" size="50" maxlenght="50" type="text"> </td>
                                    <td id="label">&nbsp;</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td id="label">Contacto</td>
                                    <td><input name="contacto" value="<?php echo ($o_Proveedor->getContacto())?$o_Proveedor->getContacto():"";?>" size="50" maxlenght="10" type="text"> </td>
                                    <td id="label"><br></td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td></td>
                                    <td></td>
                                    <td>&nbsp;</td>
                                </tr>
                            </tbody>
                        </table>
                        <table width="100%">
                            <tr>
                                <td width="90%" align="right"><input type="submit" name="guardar" value="Guardar"></td>
                                <td align="right"><input type="button" id="btn_cancelar"name="btn_cancelar" onclick="javascript: listarProveedores()" value="Cancelar"></td>  						 
                            <tr>	
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
